package good;

import org.json.JSONObject;

/**
 * 商品类
 * 
 * @author 毛建杰
 *
 */
public class Good
{
	int goodsID;
	int mallID;
	String mallName;
	String itemID;
	int customID;
	int sKlass;
	int klass;
	String sortID;
	int isMark;
	String mallIcon;
	String relateGoodsID;
	String mallTips;
	int restrictionID;
	int minBuyCount;
	int maxBuyCount;
	int canPresent;
	int buyMoneyType;
	int buyMoneyNum4;
	String buyMoneyDescr4;
	int discountPrice4;
	int buyMoneyNum3;
	String buyMoneyDescr3;
	int discountPrice3;
	int buyMoneyNum2;
	String buyMoneyDescr2;
	int discountPrice2;
	int buyMoneyNum1;
	String buyMoneyDescr1;
	int discountPrice1;
	String freeGiftItemID;
	int limit;

	public Good(int goodsID)
	{
		this.goodsID = goodsID;
	}
	
	public Good(int goodsID, int mallID, String mallName, String itemID, int customID, int sKlass, int klass,
			String sortID, int isMark, String mallIcon, String relateGoodsID, String mallTips, int restrictionID,
			int minBuyCount, int maxBuyCount, int canPresent, int buyMoneyType, int buyMoneyNum4, String buyMoneyDescr4,
			int discountPrice4, int buyMoneyNum3, String buyMoneyDescr3, int discountPrice3, int buyMoneyNum2,
			String buyMoneyDescr2, int discountPrice2, int buyMoneyNum1, String buyMoneyDescr1, int discountPrice1,
			String freeGiftItemID, int limit)
	{
		this.goodsID = goodsID;
		this.mallID = mallID;
		this.mallName = mallName;
		this.itemID = itemID;
		this.customID = customID;
		this.sKlass = sKlass;
		this.klass = klass;
		this.sortID = sortID;
		this.isMark = isMark;
		this.mallIcon = mallIcon;
		this.relateGoodsID = relateGoodsID;
		this.mallTips = mallTips;
		this.restrictionID = restrictionID;
		this.minBuyCount = minBuyCount;
		this.maxBuyCount = maxBuyCount;
		this.canPresent = canPresent;
		this.buyMoneyType = buyMoneyType;
		this.buyMoneyNum4 = buyMoneyNum4;
		this.buyMoneyDescr4 = buyMoneyDescr4;
		this.discountPrice4 = discountPrice4;
		this.buyMoneyNum3 = buyMoneyNum3;
		this.buyMoneyDescr3 = buyMoneyDescr3;
		this.discountPrice3 = discountPrice3;
		this.buyMoneyNum2 = buyMoneyNum2;
		this.buyMoneyDescr2 = buyMoneyDescr2;
		this.discountPrice2 = discountPrice2;
		this.buyMoneyNum1 = buyMoneyNum1;
		this.buyMoneyDescr1 = buyMoneyDescr1;
		this.discountPrice1 = discountPrice1;
		this.freeGiftItemID = freeGiftItemID;
		this.limit = limit;
	}

	public Good(JSONObject jsonGood)
	{
		this.goodsID = jsonGood.getInt("GoodsID");
		this.mallID = jsonGood.getInt("MallID");
		this.mallName = jsonGood.getString("MallName");
		this.itemID = jsonGood.getString("ItemID");
		this.customID = jsonGood.getInt("customID");
		this.sKlass = jsonGood.getInt("sKlass");
		this.klass = jsonGood.getInt("Klass");
		this.sortID = jsonGood.getString("sortID");
		this.isMark = jsonGood.getInt("IsMark");
		this.mallIcon = jsonGood.getString("MallIcon");
		this.relateGoodsID = jsonGood.getString("RelateGoodsID");
		this.mallTips = jsonGood.getString("MallTips");
		this.restrictionID = jsonGood.getInt("RestrictionID");
		this.minBuyCount = jsonGood.getInt("MinBuyCount");
		this.maxBuyCount = jsonGood.getInt("MaxBuyCount");
		this.canPresent = jsonGood.getInt("CanPresent");
		this.buyMoneyType = jsonGood.getInt("BuyMoneyType");
		this.buyMoneyNum4 = jsonGood.getInt("BuyMoneyNum4");
		this.buyMoneyDescr4 = jsonGood.getString("BuyMoneyDescr4");
		this.discountPrice4 = jsonGood.getInt("DiscountPrice4");
		this.buyMoneyNum3 = jsonGood.getInt("BuyMoneyNum3");
		this.buyMoneyDescr3 = jsonGood.getString("BuyMoneyDescr3");
		this.discountPrice3 = jsonGood.getInt("DiscountPrice3");
		this.buyMoneyNum2 = jsonGood.getInt("BuyMoneyNum2");
		this.buyMoneyDescr2 = jsonGood.getString("BuyMoneyDescr2");
		this.discountPrice2 = jsonGood.getInt("DiscountPrice2");
		this.buyMoneyNum1 = jsonGood.getInt("BuyMoneyNum1");
		this.buyMoneyDescr1 = jsonGood.getString("BuyMoneyDescr1");
		this.discountPrice1 = jsonGood.getInt("DiscountPrice1");
		this.freeGiftItemID = jsonGood.getString("FreeGiftItemID");
		this.limit = jsonGood.getInt("Limit");
	}

	public int getGoodsID()
	{
		return goodsID;
	}

	public int getMallID()
	{
		return mallID;
	}

	public String getMallName()
	{
		return mallName;
	}

	public String getItemID()
	{
		return itemID;
	}

	public int getCustomID()
	{
		return customID;
	}

	public int getsKlass()
	{
		return sKlass;
	}

	public int getKlass()
	{
		return klass;
	}

	public String getSortID()
	{
		return sortID;
	}

	public int getIsMark()
	{
		return isMark;
	}

	public String getMallIcon()
	{
		return mallIcon;
	}

	public String getRelateGoodsID()
	{
		return relateGoodsID;
	}

	public String getMallTips()
	{
		return mallTips;
	}

	public int getRestrictionID()
	{
		return restrictionID;
	}

	public int getMinBuyCount()
	{
		return minBuyCount;
	}

	public int getMaxBuyCount()
	{
		return maxBuyCount;
	}

	public int getCanPresent()
	{
		return canPresent;
	}

	public int getBuyMoneyType()
	{
		return buyMoneyType;
	}

	public int getBuyMoneyNum4()
	{
		return buyMoneyNum4;
	}

	public String getBuyMoneyDescr4()
	{
		return buyMoneyDescr4;
	}

	public int getDiscountPrice4()
	{
		return discountPrice4;
	}

	public int getBuyMoneyNum3()
	{
		return buyMoneyNum3;
	}

	public String getBuyMoneyDescr3()
	{
		return buyMoneyDescr3;
	}

	public int getDiscountPrice3()
	{
		return discountPrice3;
	}

	public int getBuyMoneyNum2()
	{
		return buyMoneyNum2;
	}

	public String getBuyMoneyDescr2()
	{
		return buyMoneyDescr2;
	}

	public int getDiscountPrice2()
	{
		return discountPrice2;
	}

	public int getBuyMoneyNum1()
	{
		return buyMoneyNum1;
	}

	public String getBuyMoneyDescr1()
	{
		return buyMoneyDescr1;
	}

	public int getDiscountPrice1()
	{
		return discountPrice1;
	}

	public String getFreeGiftItemID()
	{
		return freeGiftItemID;
	}

	public int getLimit()
	{
		return limit;
	}

	public int getPrice(int level)
	{
		if (level == 4)
		{
			return (discountPrice4 == -1) ? buyMoneyNum4 : discountPrice4;

		}
		else if (level == 3)
		{
			return (discountPrice3 == -1) ? buyMoneyNum3 : discountPrice3;
		}
		else if (level == 2)
		{
			return (discountPrice2 == -1) ? buyMoneyNum2 : discountPrice2;
		}
		else if (level == 1)
		{
			return (discountPrice1 == -1) ? buyMoneyNum1 : discountPrice1;
		}
		else
		{
			return 0;
		}
	}

}
